Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Imaging with QuickDraw

Previous | Chapter Top | Chapter Contents | Next |

Getting the Available Graphics Devices

To gain access to the GDevice record for a video device--for example, to determine the size and pixel depth of its attached screen--your application needs to get a handle to that record.

Your application can use the GetDeviceList function to obtain a handle to the first  GDevice record in the device list, the GetGDevice function to obtain a handle to the GDevice record for the current device, the GetMainDevice function to obtain a handle to the GDevice record for the main screen, and the GetMaxDevice function to obtain a handle to the GDevice record for the video device with the greatest pixel depth.

All existing GDevice records are linked together in the device list. After using one of these functions to obtain a handle to one of the GDevice records in the device list, your application can use the GetNextDevice function to obtain a handle to the next GDevice record in the list.

Two related functions, GetGWorld and GetGWorldDevice , also allow you to obtain handles to GDevice records. To get the GDevice record for the current device, you can use the GetGWorld function. To get a handle to the GDevice record for a particular offscreen graphics world, you can use the GetGWorldDevice function. These two functions are described in the next chapter, "Offscreen Graphics Worlds."

GetGDevice

To obtain a handle to the GDevice record for the current device, use the GetGDevice function.

FUNCTION GetGDevice: GDHandle;

DESCRIPTION

The GetGDevice function returns a handle to the GDevice record for the current device. (At any given time, exactly one video device is the current device--that is, the one on which drawing is actually taking place.)

Color QuickDraw stores a handle to the current device in the global variable TheGDevice .

SPECIAL CONSIDERATIONS

The GetGDevice function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.

GetDeviceList

To obtain a handle to the first GDevice record in the device list, use the GetDeviceList function.

FUNCTION GetDeviceList: GDHandle;

DESCRIPTION

The GetDeviceList function returns a handle to the first GDevice record in the global variable DeviceList .

SPECIAL CONSIDERATIONS

The GetDeviceList function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.

SEE ALSO

Listing 3 illustrates the use of this function.

GetMainDevice

To obtain a handle to the GDevice record for the main screen, use the GetMainDevice function.

FUNCTION GetMainDevice: GDHandle;

DESCRIPTION

The GetMainDevice function returns a handle to the GDevice record that corresponds to the main screen--that is, the one containing the menu bar.

A handle to the main device is kept in the global variable MainDevice .

SPECIAL CONSIDERATIONS

The GetMainDevice function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.

SEE ALSO

Listing 3 illustrates the use of this function.

GetMaxDevice

To obtain a handle to the GDevice record for the video device with the greatest pixel depth, use the GetMaxDevice function.

FUNCTION GetMaxDevice (globalRect: Rect): GDHandle;
globalRect
A rectangle, in global coordinates, that intersects the graphics devices that you are searching to find the one with the greatest pixel depth.

DESCRIPTION

As its function result, GetMaxDevice returns a handle to the GDevice record for the video device that has the greatest pixel depth among all graphics devices that intersect the rectangle you specify in the globalRect parameter.

SPECIAL CONSIDERATIONS

The GetMaxDevice function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.

GetNextDevice

After using the GetDeviceList function to obtain a handle to the first GDevice record in the device list, GetGDevice to obtain a handle to the GDevice record for the current device, GetMainDevice to obtain a handle to the GDevice record for the main screen, or GetMaxDevice to obtain a handle to the GDevice record for the video device with the greatest pixel depth, you can use the GetNextDevice function to obtain a handle to the next GDevice record in the list.

FUNCTION GetNextDevice (curDevice: GDHandle): GDHandle;
curDevice
A handle to the GDevice record at which you want the search to begin.

DESCRIPTION

The GetNextDevice function returns a handle to the next GDevice record in the device list. If there are no more GDevice records in the list, it returns NIL .

SPECIAL CONSIDERATIONS

The GetNextDevice function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.

SEE ALSO

Listing 3 illustrates the use of this function.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next